package com.wsm.kotlintest.common

import android.annotation.SuppressLint
import android.content.Context
import android.net.ConnectivityManager
import com.wsm.kotlintest.MyApplication
import com.wsm.kotlintest.common.net.API
import com.wsm.kotlintest.common.net.RetrofitClient


/**
 * Created by 王家宝 on 2018/7/20.
 * TEL:18241150668
 * MAIL:639586819@qq.com
 */

@SuppressLint("MissingPermission")
fun isNetworkAvailable(): Boolean {
    val cm = MyApplication.context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
    val networkInfo = cm.activeNetworkInfo
    return networkInfo != null && networkInfo.isAvailable
}

fun go(): API {
    return RetrofitClient.getInstance
}


